//
//  DepositView.swift
//  cxd4iphone
//
//  Created by hexy on 12/23/15.
//  Copyright © 2015 hexy. All rights reserved.
//

import UIKit

class DepositView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        
        makeUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func makeUI() {
        
//        let wrap = UIView(bgColor: xx_randomColor())
        let wrap = UIView()
        
        self.addSubview(wrap)
        wrap.snp_makeConstraints { (make) -> Void in
            
            make.edges.equalTo(UIEdgeInsetsMake(xx_height(20), 15, xx_height(-20), -15))
        }
        
        
        let titleLabel = UILabel(title: "诚信贷账户可用余额 (元)", fontColor: Define.moreLightFontColor, bgColor: nil, fontSize: 14, maxWrapWidth: 0)
        
        wrap.addSubview(titleLabel)
        titleLabel.snp_makeConstraints { (make) -> Void in
            
            make.top.left.equalTo(wrap)
        }
        
        wrap.addSubview(balanceLabel)
        balanceLabel.snp_makeConstraints { (make) -> Void in
            
            make.right.equalTo(wrap)
            make.centerY.equalTo(titleLabel)
        }
        
        wrap.addSubview(textField)
        textField.snp_makeConstraints { (make) -> Void in
            
            make.top.equalTo(titleLabel.snp_bottom).offset(xx_height(15))
            make.left.right.equalTo(wrap)
            make.height.equalTo(xx_height(40))
        }
        
        wrap.addSubview(nextBtn)
        nextBtn.snp_makeConstraints { (make) -> Void in
            
            make.top.equalTo(textField.snp_bottom).offset(xx_height(30))
            make.left.right.equalTo(wrap)
            make.height.equalTo(xx_height(40))
            
        }
    }
    
    lazy var balanceLabel = UILabel(title: "0.00", fontColor: Define.redColor, bgColor: nil, fontSize: 18, maxWrapWidth: 0)
    lazy var textField = UITextField(placeholder: "请输入充值金额 (元)", textAlignment: .Left, keyboardType: .NumberPad)
    
    lazy var nextBtn = UIButton(title: "下一步", titleColor: UIColor.whiteColor(), titleSize: 18, bgColor: Define.blueColor)
    
}
